Ext.ns("AllSala");

AllSala.logo = new Ext.TabPanel( {
			region: 'center',
			id: 'logo',
			frame : true,
			activeTab : 0,
			html : '<center><img id=\'img\' src=\'resources/imagens/Sistema.png\' /></center>',
			bodyStyle : {"background-color":"#DFE8F6"}
});

AllSala.creditos = new Ext.BoxComponent({
    autoEl: {
        tag: 'a',
        href: '#',
        html: '<center><img src=\'resources/imagens/signature.png\' /></center>',
		id : 'idCreditosSala'
    },
	listeners : {
		afterrender : function() {
			Ext.get('idCreditosSala').addListener('click', function(e) {
				e.preventDefault();
				if(!AllSala.janelaCreditos) {
					AllSala.janelaCreditos = new Ext.Window( {
						width : 300,
						height : 150,
						closeAction : 'hide',
						html : '<center><span style=\'font-size:13px;color:#3E65B2;text-align:center;\'><br/><b>Desenvolvido por:</b><br/><br/></span><img src=\'resources/imagens/signature.png\' /><br/><span style=\'font-size:10px;color:#3E65B2;text-align:center;\'><br/>lpereira.wd@gmail.com</span></center>'
					});
				}
				AllSala.janelaCreditos.show();
				AllSala.janelaCreditos.center();
			});
		}
	}
});

AllSala.nav_panel = new Ext.Panel( {
			region : 'west',
			id : 'nav-panel',
			title : 'Reservas PROEX',
			frame : true,
			split : false,
			width : 195,
			bbar : AllSala.creditos,
			collapsible : true,
			animCollapse : false,
			margins : '0 0 0 5',
			//html : '<img id=\'img2\' src=\'resources/imagens/signature.png\' width=\'66\' height=\'15\' title=\'lpereira.wd@gmail.com\' />',
			layoutConfig : {
				animate : true
			},
			items : [
				{
					title : ' ',
					height : 25,
					border : false
					
				},
				{
					handler: open_reserva_sala207,
					xtype : 'button',
					minWidth : 180,
					text : 'Reserva da Sala 1B207',
					height : 50,
					style : 'margin-bottom: 13px'
				},
				{
					title : ' ',
					height : 25,
					border : false
					
				},
				{
					handler: open_reserva_sala209,
					xtype : 'button',
					minWidth : 180,
					text : 'Reserva da Sala 1B209',
					height : 50,
					style : 'margin-bottom: 13px'
				},
				{
					title : ' ',
					height : 25,
					border : false
					
				},
				{
					handler: open_reserva_sala212,
					xtype : 'button',
					minWidth : 180,
					text : 'Reserva da Sala 1B212',
					height : 50,
					style : 'margin-bottom: 13px'
				},
				{
					title : ' ',
					height : 25,
					border : false
					
				},
				{
					xtype : 'button',
					text : 'Sair',
					iconCls : 'logout',
					width : 50,
					style : 'margin-left: 65px',
					handler : function() {
						var redirect = 'index.php'; 
						window.location = redirect;
					}
				}]
});

function open_reserva_sala207(){
	if(AllSala.logo.getItem('sala207_tab')){
		AllSala.logo.activate('sala207_tab');
	}
	else{
		AllSala.logo.add(new AllSala.sala207Tab);
		AllSala.logo.activate('sala207_tab');
	}
	AllSala.logo.doLayout();
}

function open_reserva_sala209(){
	if(AllSala.logo.getItem('sala209_tab')){
		AllSala.logo.activate('sala209_tab');
	}
	else{
		AllSala.logo.add(new AllSala.sala209Tab);
		AllSala.logo.activate('sala209_tab');
	}
	AllSala.logo.doLayout();
}

function open_reserva_sala212(){
	if(AllSala.logo.getItem('sala212_tab')){
		AllSala.logo.activate('sala212_tab');
	}
	else{
		AllSala.logo.add(new AllSala.sala212Tab);
		AllSala.logo.activate('sala212_tab');
	}
	AllSala.logo.doLayout();
}

AllSala.sala207Tab = function() {
	GridSala207.StoreReservas207.load();
	return new Ext.Panel({
		 id: 'sala207_tab',
		 title : 'Reserva da Sala 1B207',
		 layout : 'fit',
		 items : [ {
		 		xtype : 'panel',
				layout : 'border',
				items : [ GridSala207.grid, GridSala207.detalhes ]
		} ]
	});
}

AllSala.sala209Tab = function() {
	GridSala209.StoreReservas209.load();
	return new Ext.Panel({
		 id: 'sala209_tab',
		 title : 'Reserva da Sala 1B209',
		 layout : 'fit',
		 items : [ {
		 		xtype : 'panel',
				layout : 'border',
				items : [ GridSala209.grid, GridSala209.detalhes ]
		} ]
	});
}

AllSala.sala212Tab = function() {
	GridSala212.StoreReservas212.load();
	return new Ext.Panel({
		 id: 'sala212_tab',
		 title : 'Reserva da Sala 1B212',
		 layout : 'fit',
		 items : [ {
		 		xtype : 'panel',
				layout : 'border',
				items : [ GridSala212.grid, GridSala212.detalhes ]
		} ]
	});
}